<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vdelayxw</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vdelayxs.html" title="vdelayxs" />
    <link rel="next" href="vdelayxwq.html" title="vdelayxwq" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vdelayxw</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vdelayxs.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vdelayxwq.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="vdelayxw"></a>
      <div class="titlepage"></div>
      <a id="IndexVdelayxw" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vdelayxw</span>
        </h2>
        <p>vdelayxw — 
      Variable delay opcodes with high quality interpolation.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp163272432"></a>
        <h2>Description</h2>
        <p>
       Variable delay opcodes with high quality interpolation.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp163347872"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">aout <span class="command"><strong>vdelayxw</strong></span> ain, adl, imd, iws [, ist]</pre>
      </div>
      <div class="refsect1">
        <a id="idp163350096"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>imd</em></span> -- max. delay time (seconds)
    </p>
        <p>
      <span class="emphasis"><em>iws</em></span> -- interpolation window size (see below)
    </p>
        <p>
      <span class="emphasis"><em>ist</em></span> (optional) -- skip initialization if not zero
    </p>
      </div>
      <div class="refsect1">
        <a id="idp163353376"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>aout</em></span> -- output audio signal
    </p>
        <p>
      <span class="emphasis"><em>ain</em></span> -- input audio signal
    </p>
        <p>
      <span class="emphasis"><em>adl</em></span> -- delay time in seconds
    </p>
        <p>
      These opcodes use high quality (and slow) interpolation, that is much more accurate than the currently available linear and cubic interpolation. The <span class="emphasis"><em>iws</em></span> parameter sets the number of input samples used for calculating one output sample (allowed values are any integer multiply of 4 in the range 4 - 1024); higher values mean better quality and slower speed.
    </p>
        <p>
      The <span class="emphasis"><em>vdelayxw</em></span> opcodes change the position of the write tap in the delay line (unlike all other delay ugens that move the read tap), and are most useful for implementing Doppler effects where the position of the listener is fixed, and the sound source is moving.
    </p>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note: Notes">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Notes</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        </p>
                <div class="itemizedlist">
                  <ul class="itemizedlist" style="list-style-type: disc; ">
                    <li class="listitem">
                      <p>Delay time is measured in seconds (unlike in vdelay and vdelay3), and must be a-rate.</p>
                    </li>
                    <li class="listitem">
                      <p>The minimum allowed delay is iws/2 samples.</p>
                    </li>
                    <li class="listitem">
                      <p>Using the same variables as input and output is allowed in these opcodes.</p>
                    </li>
                    <li class="listitem">
                      <p>In vdelayxw*, changing the delay time has some effects on output volume: </p>
                      <div class="literallayout">
                        <p>a = 1 / (1 + dt)</p>
                      </div>
                      <p> where a is the output gain, and dt is the change of delay time per seconds.</p>
                    </li>
                    <li class="listitem">
                      <p>These opcodes are best used in the double-precision version of Csound.</p>
                    </li>
                  </ul>
                </div>
                <p>
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp163364544"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the use of the <span class="emphasis"><em>vdelayxw</em></span> opcode. It uses the file <a class="ulink" href="examples/vdelayxw.csd" target="_top"><em class="citetitle">vdelayxw.csd</em></a>.
      </p>
        <div class="example">
          <a id="idp163366848"></a>
          <p class="title">
            <strong>Example 990. Example of the <span class="emphasis"><em>vdelayxw</em></span> opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac  <span class="comment">;;;realtime audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if realtime audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o vdelayxw.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2
<span class="ohdr">0dbfs</span>  <span class="op">=</span> 1

<span class="oblock">instr</span> 1 

ims  <span class="op">=</span>	.5				<span class="comment">;maximum delay time in seconds</span>
iws  <span class="op">=</span>	1024				<span class="comment">;best quality</span>
adl  <span class="op">=</span>	.5				<span class="comment">;delay time</span>
asig <span class="opc">diskin2</span> "flute.aiff", .5, 0, 1	<span class="comment">;loop flute.aiff at half speed</span>
a2   <span class="opc">poscil3</span> .2, .1, 1			<span class="comment">;make an LFO, 1 cycle per 2 seconds</span>
adl  <span class="op">=</span> a2 <span class="op">+</span> ims<span class="op">/</span>2      			<span class="comment">;offset the LFO so that it is positive</span>
aout <span class="opc">vdelayxw</span> asig, adl, ims, iws	<span class="comment">;use the LFO to control delay time</span>
     <span class="opc">outs</span> aout, aout

<span class="oblock">endin</span>
<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>
<span class="stamnt">f</span>1 0 8192 10 1

<span class="stamnt">i</span> 1 0 10

<span class="stamnt">e</span>
<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp163371568"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="vdelayx.html" title="vdelayx"><em class="citetitle">vdelayx</em></a>,
      <a class="link" href="vdelayxq.html" title="vdelayxq"><em class="citetitle">vdelayxq</em></a>,
      <a class="link" href="vdelayxs.html" title="vdelayxs"><em class="citetitle">vdelayxs</em></a>,
      <a class="link" href="vdelayxwq.html" title="vdelayxwq"><em class="citetitle">vdelayxwq</em></a>,
      <a class="link" href="vdelayxws.html" title="vdelayxws"><em class="citetitle">vdelayxws</em></a>
    </p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vdelayxs.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="vdelayxwq.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vdelayxs </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vdelayxwq</td>
        </tr>
      </table>
    </div>
  </body>
</html>
